package com.coder.baseapp.mvp.base;

import android.content.Context;
import android.util.Log;

import com.coder.baseapp.mvp.model.API;
import com.coder.baseapp.wrapper.Logger;
import com.coder.baseapp.wrapper.RxManager;

import javax.inject.Inject;

import retrofit2.Retrofit;

/**
 * 基类Presenter
 *
 * @Author: Tua.CoderGui
 * *
 * @Date: 2017/3/9
 * *
 * Copyright (c) 2017 All Rights Reserved.
 */

public class BasePresenter<V extends IView> implements IPresenter<V> {
    /**
     * 采用Dagger自动注入，需要更多请自行增加.如：DataManager,RxBus,AppManager
     */
    @Inject
    protected API mApi;

    @Inject
    protected Retrofit mRetrofit;

    @Inject
    protected Context mContext;

    @Inject
    protected RxManager mRxManager;

    protected V mView;

    @Override
    public void attachView(V view) {
        this.mView = view;
    }

    @Override
    public void start() {
        Logger.d("===========================START===========================");
        Logger.d("mRetrofit = " + mRetrofit);
        Logger.d("mContext = " + mContext);
        Logger.d("mView = " + mView);
        Logger.d("===========================START===========================");
    }

    @Override
    public void detachView() {
        mRxManager.exit();
        this.mView = null;
    }
}
